package com.ds.dao;

import com.ds.config.DataSourceConfig;
import com.ds.model.User;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

public class UserDao {
    private QueryRunner queryRunner = new QueryRunner(DataSourceConfig.getDataSource());
    public User loadUserByUsername(String username) throws SQLException {
        return queryRunner.query("select * from user where username=?",new BeanHandler<>(User.class),username);
    }
}
